﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using System.IO;
using System.Net;

namespace Chapter26.DnsLookup
{
    /// <summary>
    /// UriWithUriBuilderWindow.xaml 的交互逻辑
    /// </summary>
    public partial class UriWithUriBuilderWindow : Window
    {
        public UriWithUriBuilderWindow()
        {
            InitializeComponent();

            var msPage = new Uri("http://microsoft.com/somefolder/somefile.htm?order=true");
            var query = msPage.Query;
            var absolutePath = msPage.AbsolutePath;
            var scheme = msPage.Scheme;
            var port = msPage.Port;
            var host = msPage.Host;
            var isDefaultPort = msPage.IsDefaultPort;
            MessageBox.Show(string.Format("{0},{1},{2},{3},{4},{5},{6}", msPage, query, absolutePath, scheme, port, host, isDefaultPort));

            var msPageBuilder = new UriBuilder("http", "www.microsoft.com", 80, "somefoldder/somefile.htm");
            var cimpletedUri = msPageBuilder.Uri;
            MessageBox.Show(msPageBuilder.ToString());
        }
    }
}
